package com.ruoyi.common.security.constant;

import com.ruoyi.system.api.model.dto.UserInfo;
import com.ruoyi.system.api.model.dto.UserLoginInfo;

import java.util.ArrayList;

public class RuoyiSecurityConstants {

    public static String moduleName = "ruoyi_security";

    private static UserLoginInfo systemUserLoginInfo;

    private static UserInfo userInfo;

    public static UserInfo getSystemUserInfo() {
        if (userInfo == null) {
            synchronized (RuoyiSecurityConstants.class) {
                if (userInfo == null) {
                    userInfo = new UserInfo();
                    userInfo.setUserId(0L);
                    userInfo.setUserName("system");
                    userInfo.setNickName("系统");
                    userInfo.setPostList(new ArrayList<>());
                    userInfo.setRoleList(new ArrayList<>());
                }
            }
        }
        return userInfo;
    }

    /**
     * 获取系统用户信息
     *
     * @return
     */
    public static UserLoginInfo getSystemUserLoginInfo() {
        if (systemUserLoginInfo == null) {
            synchronized (RuoyiSecurityConstants.class) {
                if (systemUserLoginInfo == null) {
                    systemUserLoginInfo = new UserLoginInfo();
                    systemUserLoginInfo.setUserId(0L);
                    systemUserLoginInfo.setUserName("system");
                    systemUserLoginInfo.setNickName("系统");
                    systemUserLoginInfo.setPassword("");
                }
            }
        }
        return systemUserLoginInfo;
    }
}
